<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<h:head>
</h:head>
<h:body>
	<p:growl id="growl" showDetail="true" sticky="true" />
	<h:form id="formAgregar">
		<h1>
			<h:outputText value="Agregar Reserva" />
		</h1>
		<p:panel>

			<table id="tablaAgregar">
				<tr>
				<td><h:outputLabel style="font-weight:bold"
							value="Username : " /></td>
					<td><h:selectOneMenu
						value="#{reservaManagedBean.reserva.usuario.username}">
						<f:selectItems value="#{usuarioManagedBean.listarMG()}" var="user"
							itemValue="#{user.username}" itemLabel="#{user.username}" />
					</h:selectOneMenu></td>

				</tr>
				<tr>
					<td><h:outputLabel style="font-weight:bold" value="Sala : " /></td>
					<td><p:inputText id="sala"
							value="#{reservaManagedBean.reserva.sala.id_sala}" /></td>
				</tr>
				<tr>
					<td><h:outputLabel style="font-weight:bold"
							value="Fecha Reserva : " /></td>
					<td><h:inputText id="fechaReserva"
							value="#{reservaManagedBean.reserva.fecha_reserva}" label="Date">
							<f:convertDateTime type="date" pattern="dd-MM-yyyy" />
						</h:inputText></td>

				</tr>
				<tr>
					<td><h:outputLabel style="font-weight:bold"
							value="Hora Inicio : " /></td>
					<td><h:inputText id="horaInicio"
							value="#{reservaManagedBean.reserva.hora_inicio}">
							<f:convertDateTime type="time" pattern="HH:mm" />
						</h:inputText></td>
				</tr>
				<tr>
					<td><h:outputLabel style="font-weight:bold"
							value="Hora Fin : " /></td>
					<td><h:inputText id="horaFin"
							value="#{reservaManagedBean.reserva.hora_fin}">
							<f:convertDateTime type="time" pattern="HH:mm" />
						</h:inputText></td>

				</tr>
				<tr>
					<td><h:outputLabel style="font-weight:bold"
							value="Reservado : " /></td>
					<td><p:selectBooleanButton
							value="#{reservaManagedBean.reserva.estaReservado}" onLabel="Si"
							offLabel="No" style="width:60px" /></td>

				</tr>
			</table>
			<h:commandButton value="Agregar"
				action="#{reservaManagedBean.agregarReservaMG()}" update=":growl">

			</h:commandButton>

			<p:confirmDialog global="true" showEffect="fade" hideEffect="explode">
				<p:commandButton value="Si" type="button"
					styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
				<p:commandButton value="No" type="button"
					styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
			</p:confirmDialog>
			<p:button value="Volver" outcome="usuario" />

		</p:panel>
	</h:form>
</h:body>
</html>